<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateGoodOrdersTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('good_orders', function (Blueprint $table) {
            $table->increments('id');
            $table->string('order_no')->default('')->comment('订单编号');
            $table->tinyInteger('pay_way')->default('0')->comment('支付方式');
            $table->decimal('amount')->default('0.00')->comment('支付金额');
            $table->tinyInteger('method')->default('0')->comment('收货方式:0=快递配送,1=到店自提');
            $table->json('address')->nullable()->comment('收货地址信息');
            $table->tinyInteger('deliver')->default('0')->comment('发货方式:0=待安排,1=平台发货,2=门店发货');
            $table->string('shop_id')->default('')->comment('发货门店ID');
            $table->string('courier_number')->nullable()->comment('快递单号');
            $table->string('courier_com')->nullable()->comment('快递企业');
            $table->decimal('courier_fee')->default('0.00')->comment('快递费用');
            $table->dateTime('order_time')->nullable()->comment('下单时间');
            $table->dateTime('pay_time')->nullable()->comment('付款时间');
            $table->dateTime('send_time')->nullable()->comment('发货时间');
            $table->dateTime('finish_time')->nullable()->comment('完成时间');
            $table->integer('province_id')->default(0)->comment('省ID');
            $table->integer('city_id')->default(0)->comment('市ID');
            $table->integer('district_id')->default(0)->comment('区ID');
            $table->tinyInteger('state')->default(0)->comment('订单状态:0=待支付,1=待发货,2=待收货,3=已完成,4=已评价,5=已退款');
            $table->tinyInteger('is_apply')->default(0)->comment('是否申请退款:0=否,1=是');
            $table->dateTime('refund_time')->nullable()->comment('退款时间');
            $table->string('refund_no')->nullable()->comment('退款单号');
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('good_orders');
    }
}
